package com.jetinno.file;

import android.app.Dialog;
import android.content.Context;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.v7.widget.DividerItemDecoration;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.widget.EditText;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by zhangyuncai on 2023/9/21.
 */
public class CommonCharDialog extends Dialog {
    private final EditText editText;

    public CommonCharDialog(@NonNull Context context, EditText editText) {
        super(context);
        this.editText = editText;
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.dialog_commonchar);

        RecyclerView rv_commonchar = findViewById(R.id.rv_commonchar);

        List<String> mDatas = new ArrayList<>();
        mDatas.add("NEW");
        mDatas.add("OLD");
        mDatas.add("ON");
        mDatas.add("OFF");
        mDatas.add("TRUE");
        mDatas.add("FALSE");
        mDatas.add("0");
        mDatas.add("1");
        mDatas.add("2");
        mDatas.add("3");
        mDatas.add("-1");
        mDatas.add("true");
        mDatas.add("false");
        mDatas.add("30");
        mDatas.add("300");
        mDatas.add("\"");
        mDatas.add("{");
        mDatas.add("}");
        mDatas.add("[");
        mDatas.add("]");
        mDatas.add(",");
        mDatas.add(":");

        CommonCharAdapter adapter = new CommonCharAdapter(this,mDatas, editText);
        rv_commonchar.setLayoutManager(new LinearLayoutManager(getContext()));
        rv_commonchar.setAdapter(adapter);
        DividerItemDecoration dividerItemDecoration = new DividerItemDecoration(getContext(), DividerItemDecoration.VERTICAL);
        rv_commonchar.addItemDecoration(dividerItemDecoration);
    }
}
